package com.ticketbooking.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class SecurityTool {
    public static boolean isReturnJson(String needPermission,HttpServletRequest request){
        boolean result = false;
        HttpSession session = request.getSession();
        String permission = (String)session.getAttribute("permission");
//        System.out.println(permission);
        if(permission!=null&&Integer.parseInt(needPermission)>=Integer.parseInt(permission)){
            //权限数值越大则权限越高
            result = true;
        }
        return result;
    }
}
